package com.xsd.prc;

import java.util.concurrent.CountDownLatch;

/**
 * @Description: 倒计时
 * @Author: zhoufuzong
 * @Created: 2021-01-03 11:44:18
 * @Version: 1.1.0
 */

public class CountDownLatchDemo {

    public static void main(String[] args) throws InterruptedException {

      CountDownLatch countDownLatch = new CountDownLatch(6);
      for (int i = 1; i <=6 ; i++) {
          new Thread(()->{
              System.out.println(Thread.currentThread().getName()+"\t 离开教室");
              countDownLatch.countDown();
          },String.valueOf(i)).start();

      };

      countDownLatch.await();
        System.out.println(Thread.currentThread().getName()+"\t 班长关门");
    }
}
